package org.example.preprocessing.readandwrite;

import java.io.File;
import java.io.FileWriter;
import java.io.IOException;

public class Example {
    public static void main(String[] args) throws IOException {
        File file = new File("src/main/resources/data/");
        file.mkdir();

        String dataFile = "src/main/resources/data/house_tiny.csv";

        // 创建文件
        File f = new File(dataFile);
        if (!f.createNewFile()) return;

        // 写入文件
        try (FileWriter writer = new FileWriter(dataFile)) {
            writer.write("NumRooms,Alley,Price\n"); // Column names
            writer.write("NA,Pave,127500\n");  // Each row represents a data example
            writer.write("2,NA,106000\n");
            writer.write("4,NA,178100\n");
            writer.write("NA,NA,140000\n");
        }
    }
}
